package org.nightstudio.common.face.action.spi;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

public abstract class NightStudioGetAction extends NightStudioAction {
	protected abstract void doHandleRequest(HttpServletRequest request,
			HttpServletResponse response, Map<String, Object> model) throws Exception;
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		try {
			Map<String, Object> model = new HashMap<String, Object>();
			this.transformParameters(request, model);
			this.doHandleRequest(request, response, model);
			return this.getSuccessModelAndView(request, model);
		} catch (Throwable t) {
			return handleThrowable(request, response, t);
		}
	}
}
